package com.chapter.sample.jvm.runtime.stack;

import java.util.concurrent.TimeUnit;

/**
 * 演示栈中的异常：StackOverflowError
 * 设置栈的大小：-Xss
 * -XX:
 */
public class StackErrorTest {

    private static int count = 1;

    public static void main(String[] args) {
//        try {
//            TimeUnit.SECONDS.sleep(1);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        try {
            count++;
            main(args);
        }catch (Throwable e) {
            System.out.println("递归次数为：" + count);
        }
    }
}
